home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / bovinated-logo.scm < prev    next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  4.6 KB  |  133 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; This program is free software; you can redistribute it and/or modify
  4. ; it under the terms of the GNU General Public License as published by
  5. ; the Free Software Foundation; either version 2 of the License, or
  6. ; (at your option) any later version.
  7. ; This program is distributed in the hope that it will be useful,
  8. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10. ; GNU General Public License for more details.
  11. ; You should have received a copy of the GNU General Public License
  12. ; along with this program; if not, write to the Free Software
  13. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  14. ;
  15. ;  Bovinated Logos v0.1 04/08/98
  16. ;  by Brian McFee <keebler@wco.com>
  17. ;  Creates Cow-spotted logs.. what else?
  18.  
  19. (define (apply-bovinated-logo-effect img
  20.                      logo-layer
  21.                      spots-x
  22.                      spots-y
  23.                      bg-color)
  24.   (let* ((width (car (gimp-drawable-width logo-layer)))
  25.      (height (car (gimp-drawable-height logo-layer)))
  26.      (bg-layer (car (gimp-layer-new img
  27.                     width height RGBA-IMAGE
  28.                     "Background" 100 NORMAL-MODE)))
  29.      (blur-layer (car (gimp-layer-new img
  30.                       width height RGBA-IMAGE
  31.                       "Blur" 100 NORMAL-MODE))))
  32.  
  33.     (gimp-context-push)
  34.  
  35.     (script-fu-util-image-resize-from-layer img logo-layer)
  36.     (gimp-image-add-layer img bg-layer 1)
  37.     (gimp-image-add-layer img blur-layer 1)
  38.  
  39.     (gimp-selection-all img)
  40.     (gimp-context-set-background bg-color)
  41.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  42.     (gimp-selection-none img)
  43.  
  44.     (gimp-layer-set-preserve-trans blur-layer TRUE)
  45.     (gimp-context-set-background '(255 255 255))
  46.     (gimp-selection-all img)
  47.     (gimp-edit-fill blur-layer BACKGROUND-FILL)
  48.     (gimp-edit-clear blur-layer)
  49.     (gimp-context-set-background '(191 191 191))
  50.     (gimp-selection-none img)
  51.     (gimp-layer-set-preserve-trans blur-layer FALSE)
  52.     (gimp-selection-layer-alpha logo-layer)
  53.     (gimp-edit-fill blur-layer BACKGROUND-FILL)
  54.     (plug-in-gauss-rle 1 img blur-layer 5.0 1 1)
  55.     (gimp-selection-none img)
  56.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  57.     (gimp-selection-all img)
  58.     (plug-in-solid-noise 1 img logo-layer 0 0 23 1 spots-x spots-y)
  59.     (gimp-brightness-contrast logo-layer 0 127)
  60.     (gimp-selection-none img)
  61.     (gimp-layer-set-preserve-trans logo-layer FALSE)
  62.     (plug-in-bump-map 1 img logo-layer blur-layer
  63.               135 50 10 0 0 0 30 TRUE FALSE 0)
  64.     (gimp-layer-set-offsets blur-layer 5 5)
  65.     (gimp-invert blur-layer)
  66.     (gimp-layer-set-opacity blur-layer 50.0)
  67.     (gimp-image-set-active-layer img logo-layer)
  68.  
  69.     (gimp-context-pop)))
  70.  
  71. (define (script-fu-bovinated-logo-alpha img
  72.                     logo-layer
  73.                     spots-x
  74.                     spots-y
  75.                     bg-color)
  76.   (begin
  77.     (gimp-image-undo-group-start img)
  78.     (apply-bovinated-logo-effect img logo-layer spots-x spots-y bg-color)
  79.     (gimp-image-undo-group-end img)
  80.     (gimp-displays-flush)))
  81.  
  82. (script-fu-register "script-fu-bovinated-logo-alpha"
  83.             _"Bo_vination..."
  84.             "Makes Cow-spotted logos"
  85.             "Brian McFee <keebler@wco.com>"
  86.             "Brian McFee"
  87.             "April 1998"
  88.             "RGBA"
  89.                     SF-IMAGE       "Image"            0
  90.                     SF-DRAWABLE    "Drawable"         0
  91.             SF-ADJUSTMENT _"Spots density X"  '(16 1 16 1 10 0 1)
  92.             SF-ADJUSTMENT _"Spots density Y"  '(4 1 16 1 10 0 1)
  93.             SF-COLOR      _"Background Color" '(255 255 255))
  94.  
  95. (script-fu-menu-register "script-fu-bovinated-logo-alpha"
  96.              _"<Image>/Script-Fu/Alpha to Logo")
  97.  
  98.  
  99. (define (script-fu-bovinated-logo text
  100.                   size
  101.                   font
  102.                   spots-x
  103.                   spots-y
  104.                   bg-color)
  105.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  106.          (border (/ size 4))
  107.      (text-layer (car (gimp-text-fontname img -1 0 0 text border TRUE size PIXELS font))))
  108.     (gimp-image-undo-disable img)
  109.     (gimp-drawable-set-name text-layer text)
  110.     (apply-bovinated-logo-effect img text-layer spots-x spots-y bg-color)
  111.     (gimp-image-undo-enable img)
  112.     (gimp-display-new img)))
  113.  
  114. (script-fu-register "script-fu-bovinated-logo"
  115.             _"Bo_vination..."
  116.             "Makes Cow-spotted logos"
  117.             "Brian McFee <keebler@wco.com>"
  118.             "Brian McFee"
  119.             "April 1998"
  120.             ""
  121.             SF-STRING     _"Text"               "Fear the Cow"
  122.             SF-ADJUSTMENT _"Font size (pixels)" '(80 2 1000 1 10 0 1)
  123.             SF-FONT       _"Font"               "RoostHeavy"
  124.             SF-ADJUSTMENT _"Spots density X"    '(16 1 16 1 10 0 1)
  125.             SF-ADJUSTMENT _"Spots density Y"    '(4 1 16 1 10 0 1)
  126.             SF-COLOR      _"Background color"   '(255 255 255))
  127.  
  128. (script-fu-menu-register "script-fu-bovinated-logo"
  129.              _"<Toolbox>/Xtns/Script-Fu/Logos")
  130.